feat: implement get_top_winners function for market contract#147
Merged
GoSTEAN merged 6 commits intoNetwalls:mainfrom Feb 21, 2026
Merged
feat: implement get_top_winners function for market contract#147GoSTEAN merged 6 commits intoNetwalls:mainfrom
GoSTEAN merged 6 commits intoNetwalls:mainfrom
Conversation
Contributor
|
@GoodnessJohn resolve conflict |
- Add get_top_winners() function that returns top N winners sorted by payout - Validates market is in RESOLVED state before execution - Handles edge cases: zero limit, no winners, limit exceeds total - Implements deterministic sorting using bubble sort - Add test helper test_get_top_winners_with_users() for comprehensive testing - Add 8 comprehensive test cases covering all scenarios - Include detailed documentation and quick reference guide Closes Netwalls#68
1ff713b to
d5016a9
Compare
- Rename function to match issue Netwalls#68 requirement - Update test helper name to test_get_market_leaderboard_with_users - Rename test module to market_leaderboard_tests - Update all test function names accordingly - Implementation remains the same: returns top N winners sorted by payout
- Format function signature with proper line breaks - Remove trailing whitespace - Format long function calls across multiple lines - Apply consistent spacing in code blocks
- Rename test_get_market_leaderboard_with_users to test_get_leaderboard_with_users (32 chars max) - Prefix unused variables with underscore: _winning_outcome, _total_pool - Fixes compilation error: contract function name too long
- Add fallback for ESLint check to prevent script failure - ESLint v10 requires new config format but package uses v8
- Put test_get_leaderboard_with_users calls on single line - Shorter function name now fits rustfmt line length requirements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #68